package com.wlanauth.web.action;

import com.wlanauth.domain.manage.User;
import com.wlanauth.web.core.BaseActionSupport;
import com.wlanauth.web.core.JsonResult;
import com.wlanauth.web.core.JsonResultConfig;
import com.wlanauth.web.core.SystemConstants;
/**
 * 系统
 * @author zz
 * @date 2012-5-10
 * @email charles.zz.life@gmail.com
 */
public class SystemAction extends BaseActionSupport {

	private static final long serialVersionUID = 1L;
	
	/**
	 * 获取当前登陆用户（操作员）
	 */			  
	public String fetchCurrentOperator(){
		this.jsonResult = new JsonResult(this,this.getCurrentOperator(),true);
		JsonResultConfig cfg = new JsonResultConfig();
		cfg.setExcludeProperties(new String[]{
				".*.role\\.systemResources.+\\.roles"
		});
		return this.actionJsonResult(cfg);
	}
	
	/**
	 * 获取当前登陆用户（普通用户）
	 */
	public String fetchCurrentUser(){
		User u = (User)this.request.getSession().getAttribute(SystemConstants.SESSION_USER_KEY);
		this.jsonResult = new JsonResult(this,u,true);
		return this.actionJsonResult();
	}
	/**
	 * 系统当前状态
	 * @return
	 */
	public String fetchCurrentStatus(){
		this.jsonResult = new JsonResult(this,System.getProperties(),true);
		return this.actionJsonResult();
	}

}
